﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/UserCenter.Master"
    Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%:SiteResource.Title() %>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
    <link type="text/css" rel="Stylesheet" href="/Content/Css/validator.css" />
    <script type="text/javascript" src="/Scripts/jquery-1.4.1.min.js"></script>
    <script type="text/javascript" src="/Scripts/formValidator.js" charset="GB2312"></script>
    <script type="text/javascript" src="/Scripts/library.js" charset="GB2312"></script>
    <script type="text/javascript" src="/Scripts/plug.js" charset="GB2312"></script>
    <script type="text/javascript">
        $(function () {
            $.formValidator.initConfig({
                formID: "form1",
                onSuccess: function (meg) {
                    return true;
                },
                onError: function (msg) {
                    return false;
                }
            });
            $("input[name='OldPassword']").formValidator({ tipID: 'OldPasswordTip', onShow: ' ', onFocus: '请输入您的现用密码', onError: "您的输入有误，请输入6-20个字符" }).inputValidator({ min: 6, max: 20, onError: '您的输入有误，请输入6-20个字符' }).regexValidator({ regExp: "^[^<>]+$", onError: "请勿包含特殊字符" });
            $("input[name='NewPassword']").formValidator({ tipID: 'NewPasswordTip', onShow: ' ', onFocus: '请输入您的新密码', onError: "您的输入有误，请输入6-20个字符" }).inputValidator({ min: 6, max: 20, onError: '您的输入有误，请输入6-20个字符' }).regexValidator({ regExp: "^[^<>]+$", onError: "请勿包含特殊字符" });
            $("input[name='Confirm']").formValidator({ tipID: 'ConfirmTip', onShow: " ", onFocus: "请再次输入您的新密码", onError: "两次输入不一致" }).inputValidator({ min: 6, max: 20, onError: "两次输入不一致" }).compareValidator({ desID: "NewPassword", operateor: "=", onError: "两次密码不一致,请重新输入" }).regexValidator({ regExp: "^[^<>]+$", onError: "请勿包含特殊字符" });
            $('#form1').submit(function () {
                if (!$.formValidator.pageIsValid('1')) {
                    return;
                }
                var popframe = new plug.PopFrame();
                popframe.OpenFrame('pop', 'clo', function () {
                    $.ajax({
                        url: '/UserCenter/Security',
                        type: 'post',
                        cache: false,
                        data: {
                            OldPassword: $('input[name="OldPassword"]').val(),
                            NewPassword: $('input[name="NewPassword"]').val(),
                            Confirm: $('input[name="Confirm"]').val()
                        },
                        beforeSend: function () {
                            $('#loadingmsgbox').text('保存中，请稍后......');
                        },
                        success: function (result) {
                            if (result == '1') {
                                $('#loadingmsgbox').text('保存成功');
                                window.setTimeout(function () {
                                    $('#clo').trigger('click');
                                }, 1200);
                            }
                            else {
                                $('#loadingmsgbox').text('保存失败，请确认后重新输入');
                                window.setTimeout(function () {
                                    $('#clo').trigger('click');
                                }, 1200);
                            }
                        }
                    });
                });
                return false;
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder" runat="server">
    <div class="usercenter-main">
        <input type="hidden" id="clo" />
        <div class="usercenter-main-topbg">
        </div>
        <form id="form1" action="/UserCenter/Security" method="post">
        <div class="usercenter-main-content">
            <div class="usercenter-main-content-title">
                <div class="usercenter-main-content-title-left">
                    修改密码</div>
            </div>
            <div class="usercenter-main-content">
                <div class="textboxs">
                    <div class="textboxs-label">
                        注册邮箱：</div>
                    <div class="textboxs-box">
                    <%var item = ViewData["User"] as MemberModel; %>
                    <%:item.UserName %>
                    </div>
                </div>
                <div class="textboxs">
                    <div class="textboxs-label">
                        我的旧密码：</div>
                    <div class="textboxs-box">
                        <input type="password" name="OldPassword" id="OldPassword" class="textboxs-ipt" /></div>
                    <div class="textboxs-message" id="OldPasswordTip"></div>
                </div>
                <div class="textboxs">
                    <div class="textboxs-label">
                        请输入新密码：</div>
                    <div class="textboxs-box">
                        <input type="password" name="NewPassword" id="NewPassword" class="textboxs-ipt" /></div>
                    <div class="textboxs-message" id="NewPasswordTip"></div>
                </div>
                <div class="textboxs">
                    <div class="textboxs-label">
                        再次输入新密码：</div>
                    <div class="textboxs-box">
                        <input type="password" name="Confirm" id="Confirm" class="textboxs-ipt" /></div>
                    <div class="textboxs-message" id="ConfirmTip"></div>
                </div>
                <div class="textboxs">
                    <div class="textboxs-label">
                    </div>
                    <div class="textboxs-box">
                        <input type="image" id="btnSubmit" src="/Content/Images/usercenter-modify.png" />
                    </div>
                </div>
            </div>
        </div>
        </form>
        <div class="usercenter-main-bottombg">
        </div>
        <div id="pop" style="display: none; width: 350px; height: 100px;">
            <div id="loadingmsgbox">
                保存中，请稍后......
            </div>
        </div>
    </div>
</asp:Content>
